package com.whw.fy.service.impl;

import com.whw.fy.entity.Message;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.whw.fy.mapper.AttendanceTeaMapper;
import com.whw.fy.entity.AttendanceTea;
import com.whw.fy.service.AttendanceTeaService;

import java.util.Date;

@Service
public class AttendanceTeaServiceImpl implements AttendanceTeaService{

    @Resource
    private AttendanceTeaMapper attendanceTeaMapper;

    @Override
    public Message deleteByPrimaryKey(Integer attTeaId) {
        return attendanceTeaMapper.deleteByPrimaryKey(attTeaId)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message insert(AttendanceTea record) {
        return attendanceTeaMapper.insert(record)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message insertSelective(AttendanceTea record) {
        record.setPostTime(new Date());
        return attendanceTeaMapper.insertSelective(record)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message selectByPrimaryKey(Integer attTeaId) {
        return Message.success(null).add(attendanceTeaMapper.selectByPrimaryKey(attTeaId));
    }

    @Override
    public Message updateByPrimaryKeySelective(AttendanceTea record) {
        return attendanceTeaMapper.updateByPrimaryKeySelective(record)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message updateByPrimaryKey(AttendanceTea record) {
        return attendanceTeaMapper.updateByPrimaryKey(record)> 0 ? Message.success(null) : Message.fail(null);
    }

    @Override
    public Message selectAll() {
        return Message.success(null).add(attendanceTeaMapper.selectAll());
    }

    @Override
    public Message selectByAll(AttendanceTea attendanceTea) {
        return Message.success(null).add(attendanceTeaMapper.selectByAll(attendanceTea));
    }

}
